package api

import (
	"api-getway/global"
	pb "api-getway/pb"
	"github.com/gin-gonic/gin"
	"net/http"
	"strconv"
)

func VideoList(c *gin.Context) {

	page, _ := strconv.Atoi(c.Query("page"))
	page_size, _ := strconv.Atoi(c.Query("page_size"))
	list, err := global.VideoClient.VideoList(c, &pb.VideoListRequest{
		Page:     int32(page),
		PageSize: int32(page_size),
	})
	if err != nil {
		return
	}
	c.JSON(http.StatusOK, gin.H{"code": 200, "msg": "视频列表", "data": list})
}
func UserList(c *gin.Context) {

	uid, _ := strconv.Atoi(c.Query("uid"))
	list, err := global.VideoClient.UserList(c, &pb.UserListRequest{
		Uid: int32(uid),
	})
	if err != nil {
		return
	}
	c.JSON(http.StatusOK, gin.H{"code": 200, "msg": "视频列表", "data": list})
}
